#pragma once

#include <google/protobuf/repeated_field.h>

#include "doc/normal_document.h"
#include "index/index.h"
#include "util/pool/pool.h"
#include "util/status.h"

namespace hawking {
namespace indexlib {

class PrimaryKeyIterator {
public:
    PrimaryKeyIterator() = default;
    virtual ~PrimaryKeyIterator() = default;

    // 1. judge it first
    virtual bool HasNext() const = 0;
    // 2. get value second
    virtual void Value(uint64_t* pk, DocId* doc_id) const = 0;
    // 3. shift next third
    virtual void Next() = 0;
};

class PrimaryKeyIndexer {
public:
    PrimaryKeyIndexer() = default;
    virtual ~PrimaryKeyIndexer() = default;

    virtual Status Lookup(
        const google::protobuf::RepeatedField<int64_t>& pks,
        SegmentContext* segment_ctx) = 0;
    virtual ReturnValue<DocId> Lookup(uint64_t pk) = 0;

    virtual uint32_t DocCount() const = 0;

    virtual std::shared_ptr<PrimaryKeyIterator> CreateIterator() const = 0;
};

}
}